| Conditions | 1 |
| Total Lines | 13 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import * as pathlib from 'path'; |
||
| 17 | |||
| 18 | public async toBuffer( |
||
| 19 | name: string, |
||
| 20 | locals: Record<string, any> = {} |
||
| 21 | ): Promise<Buffer> { |
||
| 22 | // Dynamically load docx generator function from: |
||
| 23 | // {root}/{name}/docx.ts |
||
| 24 | const path = pathlib.join(this.options.root, name, 'docx'); |
||
| 25 | const mod: any = await import(path); |
||
| 26 | const fn: DocxFunction = mod.fn; |
||
| 27 | |||
| 28 | const doc = fn(locals); |
||
| 29 | return Packer.toBuffer(doc); |
||
| 30 | } |
||
| 32 |